/*
 * MODULE NAME:    hci_flow_ctrl.h
 * DESCRIPTION:    HCI Flow Control Header (Host to Host Controller) 
 * AUTHOR:         Martin Mellody
 *
 * SOURCE CONTROL: $Id: hci_flow_ctrl.h,v 1.1.1.1 2007/12/18 05:32:40 tianwq Exp $
 *
 * LICENSE:
 *     This source code is copyright (c) 2000-2002 RDA Microelectronics.
 *     All rights reserved.
 *
 */

#ifndef rdabt_HCI_FLOWCTRL_H
#define rdabt_HCI_FLOWCTRL_H

#define HCI_linkCMD     0x80

struct rdabt_st_t_hci_queue 
{
        rdabt_host_buf_t *head, *tail;
        struct rdabt_st_t_hci_queue *next;
        u_int16 handle;
        u_int16 numCanSend;
        u_int16 packetsInHC;
        u_int8 transport_id;
        u_int8 linkType;
        u_int8 priority;    // high priority acl queue count
        u_int32 allocatedBytes;
#if RDABT_HCI_FLOWCTRL_SUPPORT==1
        u_int8 numConsumedPackets; /* This is in the Rx direction for this handle */
#endif
};

t_api rdabt_hci_fc_init(void); 
t_api rdabt_hci_fc_shutdown(void);

t_api rdabt_hci_add_transport(u_int8 transport_id, u_int8 core_type); 
t_api rdabt_hci_remove_transport(u_int8 transport_id);
t_api rdabt_hci_select_primary_transport(u_int8 transport_id); 
void rdabt_hci_waken(u_int8 transport_id);

/* set a link as high priority to send acl packet */
t_api rdabt_hci_set_high_priority_link(u_int16 handle); 

t_api rdabt_hci_is_link_queue_empty(u_int16 handle); 

t_api rdabt_hci_send_command_pdu(u_int8 transport, rdabt_host_buf_t *pdu);
t_api rdabt_hci_send_data_pdu(u_int8 type, u_int16 handle, rdabt_host_buf_t *pdu);

/* for callback to indicate flowctrl event or acl packet */
t_api rdabt_hci_handle_flowctrl_event(rdabt_host_buf_t *pdu);
t_api rdabt_hci_receive_acl_packet(u_int16 handle); 

t_api rdabt_hci_process_outgoing(u_int32 *maxNumToProcess);

#endif /* rdabt_HCI_FLOWCTRL_H */

